<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<%@include file="../included/commons.jsp"%>
		<title>文档浏览器</title>
	<style type="text/css">
	<!--
	   body{
	      margin:0px;
	      padding:0px
	   }
	-->
	</style>
	</head>

	<body>
	
		<%
			String docType = "Word.Document";
			if ("doc".equals(request.getParameter("type"))) {
				docType = "Word.Document";
			} else if ("xls".equals(request.getParameter("type"))) {
				docType = "Excel.Sheet";
			} else if ("ppt".equals(request.getParameter("type"))) {
				docType = "PowerPoint.Show";
			}
			SOAOfficeX.SOAOfficeCtrl SOACtrl = new SOAOfficeX.SOAOfficeCtrl(
					pageContext);
			// 设置SOAOFFICE中间件服务页面
			SOACtrl.ServerURL = "/soaservlet/soaserv.do";

			SOACtrl.MenubarStyle = 5;
			String workflowId = request.getParameter("workflowId");
			System.out.println("浏览文档的工作流编号:"+workflowId);
			SOACtrl.SaveDocURL = "saveofficeins.action?workflowId="
					+ workflowId;
			String tempid = request.getParameter("tempid");
			String openUrl = "selecttpl.action?template.id=" + tempid;
			if(tempid==null){
				String officeId = request.getParameter("officeId");
				if(officeId==null){
					throw new IllegalArgumentException("需要传入工作流文档编号!");
					
				}
				openUrl = "viewmsoffice.action?office.id="+officeId;
				//TODO 		
				System.out.println("文档编号: "+officeId);
			}
			String username = (String)session.getAttribute("userlocal");
			SOACtrl.webOpen(openUrl, 0, username, docType);
		%>
<div style="width:100%;height:100%;padding:0px;margin:0px">
		<%@ include file="../soaobject.jsp"%>
</div>	
	</body>
</html>
